package com.hongminzheng.openapi.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hongminzheng.openapi.mapper.SysParamMapper;
import com.hongminzheng.openapi.pojo.Route;
import com.hongminzheng.openapi.pojo.SysParam;
import com.hongminzheng.openapi.service.SysParamService;
import lombok.extern.log4j.Log4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author hmz
 * @version v1.0
 * @data 2020/09/29
 **/

@Service
public class SysParamServiceImpl implements SysParamService {

    @Autowired
    private SysParamMapper sysParamMapper;


    @Override
    public int deleteByPrimaryKey(Integer id) {
        return sysParamMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(SysParam sysParam) {
        return sysParamMapper.insert(sysParam);
    }

    @Override
    public int insertSelective(SysParam sysParam) {
        return sysParamMapper.insertSelective(sysParam);
    }

    @Override
    public SysParam selectByPrimaryKey(Integer id) {
        return sysParamMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(SysParam sysParam) {
        return sysParamMapper.updateByPrimaryKeySelective(sysParam);
    }

    @Override
    public int updateByPrimaryKey(SysParam sysParam) {
        return sysParamMapper.updateByPrimaryKey(sysParam);
    }

    @Override
    public PageInfo<SysParam> findPage(Integer pageNum, Integer pageSize, SysParam sysParam){
        PageHelper.startPage(pageNum, pageSize);
        List<SysParam> sysParams = sysParamMapper.findByName(sysParam);
        PageInfo<SysParam> pageInfo = new PageInfo<>(sysParams);
        return pageInfo;
    }

}
